var pageUrl=location.href.split('#')[0];
/*搜索*/
document.getElementById('searchBtn').onclick = function() {
    var userName = document.getElementById('userName').value;
    var age = document.getElementById('age').value;
    console.log(userName, age);
    // mui.ajax('/admin/search',{
    //     data:{
    //         userName: userName,
    //         age: age
    //     },
    //     type:'post',//HTTP请求类型
    //     success:function(data){
    //         console.log(data);
    //     },
    //     error:function(data){
    //         console.log('data',data);
    //     }
    // });
}
/*领取*/
var btns = document.getElementsByClassName("btn");
for(var i = 0; i < btns.length; i++) {
    btns[i].onclick = function() {
       var id = this.getAttribute('data-id');
        console.log(111);
        mui.confirm('确认领取吗？', '提示', ['确定', '取消'], function(e)
        {
            console.log(e);
            if (e.index == 0)
            {
                mui.ajax('/admin/receive',{
                    data:{
                        uid: id
                    },
                    type:'post',//HTTP请求类型
                    success:function(data){
                        if(data.code>=0){
                            alert("领取成功");
                            location.href="/admin/list";
                        }
                    },
                    error:function(data){
                        console.log('data',data);
                    }
                });
            }
            else
            {
                /*取消*/
                console.log('取消');
            }
        })
    }
}